Repository navigation
refactor: make runtime storage World-owned and generation-aware - #78
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runtime subsystems retained World-specific state in global maps and exposed mutable entity-indexed caches. Give those resources World ownership, use slot-indexed runtime storage, and expose per-entity results and operations while retaining old generations long enough to release external resources.
Changes
EntityTable[T]with full entity-handle validation, insertion-ordered traversal, reusable entry storage, and explicit orphan-generation cleanup. Migrate UI, visibility, audio, physics, scene, animation, and related runtime data.audio_sink(entity),scroll_position(entity),interaction(entity), visibility readers, and character controller readers. Use scroll, focus, audio, and respawn operations for writes.AudioSinkan opaque playback control handle. Copy scroll positions on input/output and character contact arrays on output. Hide the internalFocusedandLdtkRespawnmarker types.API changes
resolved_velocity(entity).set_scroll_position,is_focused,is_ldtk_respawn_requested,kinematic_character_controller_output, andkinematic_character_controller_collisions(entity).The low-level
EntityTabletype remains shared between engine packages. MakingComponentStoreprivate and completing the remaining system-to-Query migration are follow-up work.Validation
moon check --target all --deny-warn --warn-list +73: warning-free.moon test --deny-warn --warn-list +73: 389 Wasm and 80 JS tests passed.moon build --target js --release --deny-warn --warn-list +73: all three web examples built.moon fmt --check,moon info, pinned codegen--checkon 422 source files, andgit diff --checkpassed. Generated subsystem interfaces contain noEntityTable.Performance
Storage microbenchmarks ran in JS and native release builds with 8,192 entities and 20 samples. Sparse cases store one entry per 16 entities.
These measure storage operations, not game FPS or public snapshot-reader overhead. JS sparse scanning regressed slightly and native sparse lookup was approximately unchanged.
Reproduce with
moon bench selene-core/src/ecs/entity_table_bench_wbtest.mbt --target js --releaseor--target native.